import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import 'package:honeypotflutter/publicBussine/bussine_image.dart';
import '../pages/cabinet_form/logic.dart';

class CabinetFormData extends StatelessWidget {
  CabinetFormData({super.key});
  final CabinetFormLogic _logic = Get.find<CabinetFormLogic>();

  @override
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        decoration: BoxDecoration(
          border: Border.all(color: MGColors.splitColor, width: 1),
          borderRadius: BorderRadius.circular(6),
        ),
        margin: EdgeInsets.only(top: 10),
        padding: EdgeInsets.only(left: 16, right: 16, top: 10, bottom: 10),
        child: Flex(
          direction: Axis.horizontal,
          children: [
            Expanded(
              child: Obx(() => _oneWidget(title: "开始时间", data: _logic.startTime.value)),
            ),
            Expanded(
              child: Obx(() => _oneWidget(title: "结束时间", data: _logic.endTime.value)),
            ),
            Image.asset(MGImage.image("public_next"), width: 20)
          ],
        ),
      ),
      onTap: _logic.showBottomDate,
    );
  }

  Widget _oneWidget({required String title, String? data}) {
    return Column(
      children: [
        Text(
          title,
          style: TextStyle(color: MGColors.text2Color, fontSize: MGFont.textFont2),
        ),
        SizedBox(height: 5),
        Text(
          data ?? "",
          style: TextStyle(
            color: MGColors.text1Color,
            fontSize: MGFont.textFont1,
            fontWeight: FontWeight.bold,
          ),
        ),
      ],
      crossAxisAlignment: CrossAxisAlignment.start,
    );
  }
}
